<!-- rightColumnActionsRenderer.vue -->
<template>
    <div style="width:100%;height:100%;display: flex;justify-content: center;align-items: center">
        <div style="width:60%;height:100%;display: flex;justify-content: center;align-items: center">
            <Button v-if="buttons.includes('editProdInfo')" link type="link" @click="saveProdData">补充信息</Button>
            <Button v-if="buttons.includes('del')" type="link" danger @click="delData">删除</Button>
        </div>
    </div>


</template>

<script setup>
import { Button } from 'ant-design-vue';
import {ref, onMounted, nextTick, defineComponent} from 'vue'
import editProdInfo  from "./editProdInfo.vue"
import dayjs from 'dayjs'
import { useVbenModal } from '@vben/common-ui';


const [editProdInfoModal, editProdInfoModalApi] = useVbenModal({
  connectedComponent: editProdInfo,
});
const props = defineProps({ params: Object })
const value = ref(props.params.value || dayjs().format('YYYY-MM-DD'))
const buttons = ref([])
function getValue() {
    return value.value
}
const delData = ()=>{
    props.params.context.deleteRow(props.params.node.rowIndex);
}

const saveProdData = ()=>{
    props.params.context.saveProdData(props.params.node.rowIndex,props.params.data);

    // editProdInfoModalApi.setData({data:props.params.data}).open()
}

function onChange() {
    props.params.api.stopEditing()
}

onMounted(() => {
    // 可选：自动聚焦或其他初始化逻辑

    buttons.value = props.params.context.buttons || []
    nextTick(()=>{
    })
})

defineExpose({ getValue })
defineComponent({
    name:"rightColumnActionsRenderer"
})
</script>
